// Drummer Button Array
// by Andrea Bianchi
// drummer.alsoplantsfly.com

/*
Copyright (C) 2009, Andrea Bianchi
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

public class ButtonArray
{
 public ButtonArray ()
 {
   bg0= loadImage ("wifi.png");
   bg1= loadImage ("1.png");
   bg2= loadImage ("2.png");
   size= bg0.width;
   kit1= true;
 }
 
 void draw()
 {
   // button 1
   fill(color(255,255,255));
   if (netw.isInitialized())
     fill(color(0,255,0));
   rect (width-size, 0, size, size);
   image (bg0, width-size, 0);
   
   // button 2
   fill (30);
   if (kit1 && netw.isInitialized())
     fill (color(0,255,0));
   rect (width-size, size, size, size);
   image (bg1, width-size, size);
   
   // button 3
   fill (30);
   if (!kit1 && netw.isInitialized())
     fill (color(0,255,0));
   rect (width-size, size*2, size, size);
   image (bg2, width-size, size*2);
 }
 
 
 void press()
 {
   // check if any button is pressed
  if (mouseX>width-size)
  {      
    if (mouseY>size && mouseY<size*2){
      kit1= true;
      setKit1 (kit1);
    }else if (mouseY>size*2){
      kit1=false; 
      setKit1 (kit1);
    }else{
      netw.toggleNetwork();
    }
  }
 }
 
 
 private boolean kit1;
 private PImage bg0,bg1,bg2;  
 private int size;
}
